/*
 * Creation : 27/09/2013
 */
/**
 * 
 */
package com.japcatalog.managedbean;

import java.util.Collection;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.japcatalog.model.Trademark;
import com.japcatalog.service.TrademarkService;
import com.japcatalog.service.impl.TrademarkServiceImpl;

/**
 * The Class TrademarkManagedBean.
 * 
 * @author Fernando Ariel Perelli
 */
@ManagedBean(name = "trademark")
@ViewScoped
public class TrademarkManagedBean {

	/** The trademark. */
	private Trademark trademark;

	/** The trademarks. */
	private Collection<Trademark> trademarks;

	/** The trademark service. */
	private TrademarkService trademarkService = new TrademarkServiceImpl();

	/**
	 * Getter trademark.
	 * 
	 * @return the trademark
	 */
	public Trademark getTrademark() {
		return trademark;
	}

	/**
	 * Setter trademark.
	 * 
	 * @param trademark
	 *            the trademark to set
	 */
	public void setTrademark(Trademark trademark) {
		this.trademark = trademark;
	}

	/**
	 * Getter trademarks.
	 * 
	 * @return the trademarks
	 */
	public Collection<Trademark> getTrademarks() {
		return trademarks;
	}

	/**
	 * Setter trademarks.
	 * 
	 * @param trademarks
	 *            the trademarks to set
	 */
	public void setTrademarks(Collection<Trademark> trademarks) {
		this.trademarks = trademarks;
	}

	/**
	 * Getter trademarkService.
	 * 
	 * @return the trademarkService
	 */
	public TrademarkService getTrademarkService() {
		return trademarkService;
	}

	/**
	 * Setter trademarkService.
	 * 
	 * @param trademarkService
	 *            the trademarkService to set
	 */
	public void setTrademarkService(TrademarkService trademarkService) {
		this.trademarkService = trademarkService;
	}

	/**
	 * List trademarks.
	 */
	public void listTrademarks() {
		this.trademarks = this.trademarkService.findAll();
	}

	/**
	 * Save.
	 * 
	 * @param trademark
	 *            the trademark
	 */
	public void save(Trademark trademark) {
		this.trademarkService.create(trademark);
	}

	/**
	 * Update.
	 * 
	 * @param trademark
	 *            the trademark
	 */
	public void update(Trademark trademark) {
		this.trademarkService.update(trademark);
	}

	/**
	 * Delete.
	 * 
	 * @param trademark
	 *            the trademark
	 */
	public void delete(Trademark trademark) {
		this.trademarkService.delete(trademark);
	}
}
